/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2019-02-13 Time: 23:12
 *
 */
import {RequestAction, RequestMethod} from "../configuration/RequestConfiguration"
import {AppRequestPath} from "../configuration/AppConfig"
import {API_PROCEDURE2} from "../constant/API"
import global from "../configuration/global";


/**
 * 工单操作 （挂起、拒绝工单、退回下单部门）
 * @param action
 * @param str 条件
 * @param procedure 存储过程
 * @returns {*}
 */
export const requestOrderChangeState = (action, str ,procedure) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : procedure,
            "jn" : str,
            "jnJson2" : '{}',
        },
        action
    )
};

/**
 * 派工
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestDispatchOrder = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsRepairRecordDispatch",
            "jn" : str,
            "jnJson2" : '{}',
        },
        action
    )
};

/**
 * 完成
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestCompleteOrder = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsRepairRecordComplete",
            "jn" : str,
            "jnJson2" : '{}',
        },
        action
    )
};

/**
 * 删除
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestDeleteOrder = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsRepairRecordDelete",
            "jn" : str,
            "jnJson2" : '{}',
        },
        action
    )
};


/**
 * 继续处理
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestContinueOrder = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsRepairRecordContinue",
            "jn" : str,
            "jnJson2" : '{}',
        },
        action
    )
};

/**
 * 获取耗材记录
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestGetRecordSum = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsRetrieveviewRecordSum",
            "jn" : str,
            "jnJson2":"{}",
            "jnJson3" : "list",
        },
        action
    )
};


/**
 * 完成耗材添加
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestMaterialRecordOut = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "QmsMaterialRecordOut",
            "jn" : str,
            "jnJson2":"{}",
        },
        action
    )
};

/**
 * 修改清洁工单状态
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestChangeSweepOrderStatus = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "WHSKOrderSweepEvent",
            "jn" : str,
            "jnJson2":"{}",
        },
        action
    )
};

/**
 * 修改其他工单状态
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestChangeOrderStatus = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "WHSKOrderEvent",
            "jn" : str,
            "jnJson2":"{}",
        },
        action
    )
};




/**
 * 获取客房服务员工表
 * @param action
 * @param str 条件
 * @returns {*}
 */
export const requestRetrieveWHSKAlinusers = (action, str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu" : "WHSKAlinusersRetrieve",
            "jn" : str,
            "jnJson2":"{}",
        },
        action
    )
};






